{% extends 'custom_admin/base.html' %}

{% block content %}
<div class="card">
    <div class="card-header">
        <h5><i class="fas fa-info-circle me-2"></i>产品详情</h5>
    </div>
    <div class="card-body">
        <div class="row">
            <div class="col-md-6">
                <h6><strong>产品名称:</strong></h6>
                <p>{{ product.name }}</p>
                
                <h6><strong>价格:</strong></h6>
                <p class="text-success fs-5">¥{{ product.price|floatformat:2 }}</p>
                
                <h6><strong>店铺信息:</strong></h6>
                <p>{{ product.shop_name }} ({{ product.shop_type }})</p>
                
                <h6><strong>评价数量:</strong></h6>
                <p>{{ product.d_rate_nums }} 条评价</p>
                
                {% if product_rate %}
                <h6><strong>平均评分:</strong></h6>
                <p>{{ product_rate|floatformat:1 }} 分</p>
                {% endif %}
            </div>
            <div class="col-md-6">
                {% if product.image_link %}
                <img src="{{ product.image_link.url }}" class="img-fluid rounded" style="max-height: 300px;">
                {% endif %}
            </div>
        </div>
        
        {% if comments %}
        <hr>
        <h6><strong>相关评论:</strong></h6>
        {% for comment in comments %}
        <div class="border rounded p-2 mb-2">
            <small class="text-muted">{{ comment.user.username }} - {{ comment.create_time|date:"Y-m-d H:i" }}</small>
            <p class="mb-0">{{ comment.content }}</p>
        </div>
        {% endfor %}
        {% endif %}
    </div>
</div>
{% endblock %}